<template>
	<div class="p-4">
		<a-row>
			<a-col :span="24">
				<a-card :loading="loading" :bordered="false" title="分销员概况" :style="{ marginTop: '10px' }">
					<template #extra>
						<a href="#">
							<RightOutlined style="color:#000;" />
						</a>
					</template>

					<a-row>
						<a-col span="12">
							<a-row class="colorGray">
								累积分销员数
							</a-row>
							<a-row class="priceTwo">
								185
							</a-row>
							<a-row class="line_bottom">
								<span class="colorGray">较前一周</span>
								<ArrowUpOutlined style="color:#45a110;margin-top:5px;margin-left:5px" />
								<span class="bfb">55.44%</span>
							</a-row>
						</a-col>
						<a-col span="12">
							<a-row class="colorGray">
								分销员成交金额
							</a-row>
							<a-row class="priceTwo">
								185
							</a-row>
							<a-row class="line_bottom">
								<span class="colorGray">较前一周</span>
								<ArrowUpOutlined style="color:#45a110;margin-top:5px;margin-left:5px" />
								<span class="bfb">55.44%</span>
							</a-row>
						</a-col>
						<a-col span="12" style="margin-top:20px;">
							<a-row class="colorGray">
								分销员成交客户数
							</a-row>
							<a-row class="priceTwo">
								185
							</a-row>
							<a-row class="line_bottom">
								<span class="colorGray">较前一周</span>
								<ArrowUpOutlined style="color:#45a110;margin-top:5px;margin-left:5px" />
								<span class="bfb">55.44%</span>
							</a-row>
						</a-col>
					</a-row>
					<LineMulti :chartData="barMultiData" height="50vh" :option="multiBarOption" type="line"></LineMulti>
				</a-card>
			</a-col>
		</a-row>
	</div>
</template>
<script lang="ts" setup>
	import { ref } from 'vue';
	import HeadInfo from '/@/components/chart/HeadInfo.vue';
	import { getLoginfo, getVisitInfo } from '../api.ts';
	import { getData, formSchema } from '../chartdemo.data.ts';
	import LineMulti from '/@/components/chart/LineMulti.vue';
	import { ArrowUpOutlined, RightOutlined, MenuUnfoldOutlined, CloseOutlined } from '@ant-design/icons-vue';
	const { barMultiData } = getData;
	const loading = ref(true);

	setTimeout(() => {
		loading.value = false;
	}, 500);

	const loginfo = ref({});
	const lineMultiData = ref([]);

	function initLogInfo() {
		getLoginfo(null).then((res) => {
			if (res.success) {
				Object.keys(res.result).forEach((key) => {
					res.result[key] = res.result[key] + '';
				});
				loginfo.value = res.result;
			}
		});
		getVisitInfo(null).then((res) => {
			if (res.success) {
				lineMultiData.value = [];
				res.result.forEach((item) => {
					lineMultiData.value.push({ name: item.type, type: 'ip', value: item.ip });
					lineMultiData.value.push({ name: item.type, type: 'visit', value: item.visit });
				});
			}
		});
	}

	initLogInfo();
</script>

<style lang="less" scoped>
	.one {
		display: flex;
		align-items: center;
		margin: 10px 0 0 0;
	}

	.line_bottom {
		display: flex;
		align-items: center;
	}

	.price {
		color: #323233;
		font-size: 32px;
		font-weight: 700;
	}

	.priceTwo {
		color: #323233;
		font-size: 23px;
		font-weight: 500;
	}

	.bfb {
		color: #323233;
		font-weight: 500;
		margin-top: 4px;
	}

	.colorGray {
		margin-top: 4px;
		color: #969799;
		font-size: 14px;
	}

	.circle-cust {
		position: relative;
		top: 28px;
		left: -100%;
	}

	.extra-wrapper {
		line-height: 55px;
		padding-right: 24px;

		.extra-item {
			display: inline-block;
			margin-right: 24px;

			a {
				margin-left: 24px;
			}
		}
	}

	/* 首页访问量统计 */
	.head-info {
		position: relative;
		text-align: left;
		padding: 0 32px 0 0;
		min-width: 125px;

		&.center {
			text-align: center;
			padding: 0 32px;
		}

		span {
			color: rgba(0, 0, 0, 0.45);
			display: inline-block;
			font-size: 0.95rem;
			line-height: 42px;
			margin-bottom: 4px;
		}

		p {
			line-height: 42px;
			margin: 0;

			a {
				font-weight: 600;
				font-size: 1rem;
			}
		}
	}
</style>